#!/bin/bash


sqoop import \
--connect jdbc:mysql://hadoop01:3306/teach \
--username root \
--password 123456 \
--query "select * from class_studying_student_count where 1=1 and  \$CONDITIONS" \
--fields-terminated-by '\t' \
--hcatalog-database edu_ods \
--hcatalog-table class_studying_student_count \
-m 1

sqoop import \
--connect jdbc:mysql://hadoop01:3306/teach \
--username root \
--password 123456 \
--query "select * from course_table_upload_detail where 1=1 and  \$CONDITIONS" \
--fields-terminated-by '\t' \
--hcatalog-database edu_ods \
--hcatalog-table course_table_upload_detail \
-m 1

sqoop import \
--connect jdbc:mysql://hadoop01:3306/teach \
--username root \
--password 123456 \
--query "select * from student_leave_apply where 1=1 and  \$CONDITIONS" \
--fields-terminated-by '\t' \
--hcatalog-database edu_ods \
--hcatalog-table student_leave_apply \
-m 1

sqoop import \
--connect jdbc:mysql://hadoop01:3306/teach \
--username root \
--password 123456 \
--query "select * from tbh_class_time_table where 1=1 and  \$CONDITIONS" \
--fields-terminated-by '\t' \
--hcatalog-database edu_ods \
--hcatalog-table tbh_class_time_table \
-m 1

sqoop import \
--connect jdbc:mysql://hadoop01:3306/teach \
--username root \
--password 123456 \
--query "select * from tbh_student_signin_record where 1=1 and  \$CONDITIONS" \
--fields-terminated-by '\t' \
--hcatalog-database edu_ods \
--hcatalog-table tbh_student_signin_record \
-m 1

a=$?
if [ ${a} -eq 0 ];then 
	echo 'Program running status return code:' ${a}
	echo '=============================打完收工！=============================='
else 
	echo 'Program running status return code:' ${a}
	echo '=============================程序出BUG咯！=============================='
	fi